package com.zhinan.utils;

import java.util.Random;

/**
 * @Description: 生成随机盐的工具类
 * @Author: ZhiNan
 * @Date: 2023-04-13 14:06
 * @Version: 1.0
 */
public class SaltUtils {
    public static String getSalt(int n) {
        char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()".toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            char aChar = chars[new Random().nextInt(chars.length)];
            sb.append(aChar);
        }
        return sb.toString();
    }

}
